

using System;
using System.Collections.Generic;
using System.Text;
using EntityLayer;
using System.Data;
using DataAccessLayer;
using InfraStructureLayer;

namespace DataLayer
{
	public class datBlogrollLinks
	{
		public datBlogrollLinks()
		{
		}
		
		#region  Code Factory Generated Methods
		public void DeleteBlogrollLinksByBlogrollLinkId(entBlogrollLinks parEntBlogrollLinks, DbConnector parDbConnector)
		{
			DbParamCollection insDbParamCollection = new DbParamCollection();
			insDbParamCollection.Add("@pBlogrollLinkId",parEntBlogrollLinks.BlogrollLinkId);
			parDbConnector.ExecuteNonQuery("DeleteBlogrollLinksByBlogrollLinkId",insDbParamCollection);
		}
		public void InsertBlogrollLinks(entBlogrollLinks parEntBlogrollLinks, DbConnector parDbConnector)
		{
			DbParamCollection insDbParamCollection = new DbParamCollection();
			insDbParamCollection.Add("@pBlogrollLinkDescription",parEntBlogrollLinks.BlogrollLinkDescription);
			insDbParamCollection.AddOutput("@pBlogrollLinkId",DbType.Int32);
			parDbConnector.ExecuteNonQuery("InsertBlogrollLinks",insDbParamCollection);
			parEntBlogrollLinks.BlogrollLinkId = Convert.ToInt32(insDbParamCollection.GetOutPutParameter().Value);
		}
		public void UpdateBlogrollLinksByBlogrollLinkId(entBlogrollLinks parEntBlogrollLinks, DbConnector parDbConnector)
		{
			DbParamCollection insDbParamCollection = new DbParamCollection();
			insDbParamCollection.Add("@pBlogrollLinkId",parEntBlogrollLinks.BlogrollLinkId);
			
			insDbParamCollection.Add("@pBlogrollLinkDescription",parEntBlogrollLinks.BlogrollLinkDescription);
			parDbConnector.ExecuteNonQuery("UpdateBlogrollLinksByBlogrollLinkId",insDbParamCollection);
		}
		public DataTable SelectBlogrollLinks(DbConnector parDbConnector)
		{
			
			return parDbConnector.ExecuteDataTable("SelectBlogrollLinks",null);
		}
		public void SelectBlogrollLinksByBlogrollLinkId(entBlogrollLinks parEntBlogrollLinks, DbConnector parDbConnector)
		{
			DbParamCollection insDbParamCollection = new DbParamCollection();
			insDbParamCollection.Add("@pBlogrollLinkId",parEntBlogrollLinks.BlogrollLinkId);
			DataTable insDataTable = new DataTable();
			insDataTable = parDbConnector.ExecuteDataTable("SelectBlogrollLinksByBlogrollLinkId",insDbParamCollection);
			if (insDataTable.Rows.Count>0)
			{
				if (insDataTable.Rows[0]["BlogrollLinkId"]!=DBNull.Value)
				{
					parEntBlogrollLinks.BlogrollLinkId = Convert.ToInt32(insDataTable.Rows[0]["BlogrollLinkId"]);
				}
				if (insDataTable.Rows[0]["BlogrollLinkDescription"]!=DBNull.Value)
				{
					parEntBlogrollLinks.BlogrollLinkDescription = insDataTable.Rows[0]["BlogrollLinkDescription"].ToString();
				}
			}
		}
		#endregion

        public DataTable SelectBlogrollLinksRandom(DbConnector parDbConnector)
        {
            DbParamCollection insDbParamCollection = new DbParamCollection();
            insDbParamCollection.Add("@pLanguageId", CurrentContext.LanguageId);
            return parDbConnector.ExecuteDataTable("SelectBlogrollLinksRandom", insDbParamCollection);
        }
        public DataTable SelectBlogrollLinksByLanguageId(DbConnector parDbConnector)
        {
            DbParamCollection insDbParamCollection = new DbParamCollection();
            insDbParamCollection.Add("@pLanguageId", CurrentContext.LanguageId);
            return parDbConnector.ExecuteDataTable("SelectBlogrollLinksByLanguageId", insDbParamCollection);
        }
	}
}